package com.tang.java8.FunctionalInterface;

import java.util.function.Supplier;

/**
 * @author tlm
 * @version 1.0
 * @date 2020/3/14 18:37
 */
public class SupplierTest {
    public static void main(String[] args) {
        //  Supplier 供给型接口 没有参数，只有返回值
        //  1.普通用法
        Supplier supplier = new Supplier() {
            @Override
            public Object get() {
                return "abc";
            }
        };
        System.out.println(supplier.get());

        //  2.lambda表达式简化
        Supplier supplier1 = ()-> "abc";
        System.out.println(supplier1.get());
    }
}
